<?php
namespace app\backend\model;
trait FormDateTrait
{
    // 组合表单默认值
    protected static function mergeDefaultFormData($data, $default_value)
    {
        array_push($data, [
            'type' => 'hidden',
            'name' => 'id',
            'label' => '',
        ]);
        foreach ($data as &$v) {
            if (!empty($default_value) && isset($default_value[$v['name']])) {
                $v['value'] = $default_value[$v['name']];
            }else{
                $v['value'] = null;
            }
        }
        return $data;
    }
    public static function getList($where,$per_page = null)
    {
        $per_page = $per_page ? $per_page : config('num_each_page');
        return self::where($where)->order('id desc')->paginate($per_page);
    }
}